# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
if six.PY3:
    from urllib.parse import quote
else:
    from urllib import quote


def generic(d):
    querystring = "&".join([quote(k) + "=" + quote(v) for (k, v) in d.items()])
    return "http://example.org/?%s" % querystring


def url(d):
    if ('fragment' not in d and 'query' not in d):
        return "%(scheme)s://%(netloc)s%(path)s" % d
    elif 'fragment' not in d:
        return "%(scheme)s://%(netloc)s%(path)s?%(query)s" % d
    elif 'query' not in d:
        return "%(scheme)s://%(netloc)s%(path)s#%(fragment)s" % d
    else:
        return "%(scheme)s://%(netloc)s%(path)s?%(query)s#%(fragment)s" % d


def eulaw(d):
    raise NotImplementedError()
